﻿using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Effects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Documents;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using 纸片人.ConvertClass;
using 纸片人.win2dEffectControl.DataClass;
using 纸片人.CalculateControls;
// The Templated Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234235

namespace 纸片人.win2dEffectControl
{
    public  class GaussianBlurEffectControl : EffectControl
    {
        private ComboBox optimizationComboBox;
        private ComboBox borderModeComboBox;
        private TextBoxSlider blurAmountSlider;

        List<EffectOptimization> listOptimization = new List<EffectOptimization>();
        List<EffectBorderMode> listBorderMode = new List<EffectBorderMode>();

    
        public GaussianBlurEffectControl()
        {
          
           
            this.DefaultStyleKey = typeof(GaussianBlurEffectControl);
            listOptimization = EffectUtil.GetEnumList<EffectOptimization>();
            listBorderMode = EffectUtil.GetEnumList<EffectBorderMode>();
              OneEffetData = new GaussianBlurEffectData();
        }


       

        public override EffectOneSourceData OneEffetData { get; set; }

        protected override void OnApplyTemplate()
        {
        

            base.OnApplyTemplate();

            SetEffectName("高斯模糊效果", "GaussianBlurEffect");

            blurAmountSlider = GetTemplateChildFormName<TextBoxSlider>(nameof(blurAmountSlider));
            SetTextBoxSlider(blurAmountSlider, EffectData, nameof(GaussianBlurEffectData.BlurAmount));

            optimizationComboBox = GetTemplateChildFormName<ComboBox>(nameof(optimizationComboBox));
            SetComboBox(optimizationComboBox, listOptimization, EffectData, nameof(GaussianBlurEffectData.Optimization));

            borderModeComboBox = GetTemplateChildFormName<ComboBox>(nameof(borderModeComboBox));
            SetComboBox(borderModeComboBox, listBorderMode, EffectData, nameof(GaussianBlurEffectData.BorderMode));

        }
    }
}
